#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "exif_handler.h"
#include "exif_utils.h"

#define MAX_EXIF_SIZE 1024

static unsigned char exif_data[MAX_EXIF_SIZE];

// Function to modify the Maker information in EXIF data
int modify_maker(const char *filename, const char *new_maker) {
    // Read the existing EXIF data
    if (read_exif_data(filename, exif_data, MAX_EXIF_SIZE) != 0) {
        return -1; // Error reading EXIF data
    }

    // Modify the Maker information
    if (set_exif_maker(exif_data, new_maker) != 0) {
        return -1; // Error setting Maker
    }

    // Write the modified EXIF data back to the file
    if (write_exif_data(filename, exif_data, MAX_EXIF_SIZE) != 0) {
        return -1; // Error writing EXIF data
    }

    return 0; // Success
}

// Function to modify the ISO information in EXIF data
int modify_iso(const char *filename, int new_iso) {
    // Read the existing EXIF data
    if (read_exif_data(filename, exif_data, MAX_EXIF_SIZE) != 0) {
        return -1; // Error reading EXIF data
    }

    // Modify the ISO information
    if (set_exif_iso(exif_data, new_iso) != 0) {
        return -1; // Error setting ISO
    }

    // Write the modified EXIF data back to the file
    if (write_exif_data(filename, exif_data, MAX_EXIF_SIZE) != 0) {
        return -1; // Error writing EXIF data
    }

    return 0; // Success
}